<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>前后对比视觉效果</title>
	<style type="text/css">
		/* A tweak of an original pen by Dylan Yee
https://codepen.io/dylanyee/pen/Hjqxy?limit=all&page=6&q=css+background
*/

/*@import "bourbon";*/

html {
  font-family: sans-serif;
  font-size: 13px;
}
.container {
  position: relative;
  background: #f1f1f1;
  margin: 40px auto;
  width: 80%;
  height: 360px;
}
.left-bg, .right-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  transition: .25s ease;
  background-size: cover;
  background-repeat: no-repeat;
}
.left-bg {
  background-color:#24800f;
  background-image: url(img/back.png);
  left: 0;
}
.right-bg {
  background-color:#5988ad;
  background-image: url(img/test.jpeg);
  background-position: right;
  right: 0;
}
.right-bg:before {
  content: "OR";
  font-weight: bold;
  position: absolute;
  background: white;
  text-align: center;
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 15px;
  top: 150px;
  left: 0;
  -webkit-transform: translate(-50%, -50%);
}
.right-bg:after {
  content: " ";
  height: 280px;
  width: 1px;
  background-color: white;
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
}
.right-bg:after {
  right: 0;
}
.left-bg:hover {
  width: 60%;
}
.left-bg:hover + .right-bg {
  width: 40%;
}
.right-bg:hover {
  width: 60%;
}
.right-bg:hover + .left-bg {
  width: 40%;
}
	</style>
</head>
<body>
	<div class="container">
		<div class="left-bg">
		</div>
		<div class="right-bg"></div>
	</div>
</body>
</html>